/**
 * 侧边导航点击颜色设置
 */

//左侧a标签们(点击的连接们)
let allA = document.querySelectorAll('.nav li  li a');
allA.forEach(item=>{
    item.addEventListener('click',function(){
        document.querySelector('.nav li  li a.active').classList.remove('active');
        this.classList.add('active');
    });
});


//初始化数据.
document.querySelector('.init').addEventListener('click',function(){
    //发送ajax请求初始化数据
    axios({
        url:'/init/data'
    })
    .then(res=>{
        console.log(res);
    });
});

//退出
let logout = document.querySelector('.logout');
logout.addEventListener('click',function(){
    //清除token
    localStorage.removeItem('my_token8283');
    //跳转到登录页. 
    toastr.success('即将退出回到登录页');
    setTimeout(function(){
        location.href = './login.html';
    },1000);
});



